package com.lkbaby.memonto;

/**
 * 创建并在 Memento 中存储状态
 */
public class Originator {
	private String state;

	public void setState(String state) {
		this.state = state;
	}

	public String getState() {
		return state;
	}

	// 保存状态到memento中
	public Memento saveStateToMemento() {
		return new Memento(state);
	}

	// 从memento中恢复状态
	public void getStateFromMemento(Memento memento) {
		state = memento.getState();
	}
}
